﻿using System;

public delegate bool GradePrint(Student s);

public class Student
{
    public string Name { get; set; }
    public string StudentId { get; set; }
    public double Score { get; set; }
    public GradePrint GP { set; get; }  // 委托属性

    public Student(string name, string id, double score)
    {
        Name = name;
        StudentId = id;
        Score = score;
    }

    // 使用委托打印成绩
    public bool PrintGrade()
    {
        return GP?.Invoke(this) ?? false;
    }
}

public class GradeReport
{
    // 成绩单打印模板
    public static bool GradeReportOrderByTerm(Student s)
    {
        Console.WriteLine($"学生: {s.Name}, 成绩: {s.Score}");
        return true;
    }
}

class Program
{
    static void Main(string[] args)
    {
        Student student = new Student("张三", "001", 85.5);

        // 设置打印模板
        student.GP = GradeReport.GradeReportOrderByTerm;

        // 使用委托打印成绩
        student.PrintGrade();
    }
}